package cn.qq.xiangmu.entity;

import java.util.Objects;

public final class Dog extends Pet {

    private String strain;

    public Dog() {

    }

    public Dog(String name, int health, int love, String strain) {
        super(name, health, love);
        this.strain = strain;
    }

    public String getStrain() {
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }

    @Override
    public void print() {
        super.print();
        System.out.println(",我是一只" + strain);
    }

    @Override
    public String toString() {
        return "Dog{" +
                "strain='" + strain + '\'' +
                "} " + super.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dog dog = (Dog) o;
        return Objects.equals(strain, dog.strain);
    }

    @Override
    public void f1() {

    }

    @Override
    public void eat() {
        System.out.println("吃狗粮");
        this.setHealth(this.getHealth()+3);
    }

    //狗独有的方法，不适合声明在父类中
    public void catchingFlyDisc(){
        System.out.println("接飞盘");
        this.setHealth(this.getHealth()-10);
        super.setLove(super.getLove()+5);

    }
}

